
@extends('admin.master')

@section('title', '修改密码')

@section('title_top')
    @parent
    <div class="title_top">修改密码</div>
@stop
@section('equip_query')
<div class="title_edit">请按照提示修改密码</div>
@stop
@section('userinfo_tab')
<div class="edit_gb">
  <div class="edit_box" style="width:370px;">
    <div>输入旧密码<input class="old_pwd" type="password" placeholder="请输入旧密码"/><label class="requiredCharacter">*</label></div>
    <div style="margin:20px 0;">输入新密码<input class="new_pwd" type="password" placeholder="请输入新密码"/><label class="requiredCharacter">*</label></div>
    <div>确认新密码<input class="confirm_pwd" type="password" placeholder="请输入新密码"/><label class="requiredCharacter">*</label></div>
    <div class="edit_btn">
      <a class="return_btn" href="javascript:history.go(-1);">返回</a>
      <a class="alter_pwd">修改</a>
    </div>
  </div>
</div>
@stop
@section('infor_promit')
@parent
    <script type="text/javascript">
    //修改密码
    $(".alter_pwd").click(function(){
        alterPassword();

    });
    function alterPassword(){
        var old =$(".old_pwd").val();
        var new_pwd=$(".new_pwd").val();
        var con_pwd=$(".confirm_pwd").val();
        $.ajax({
            url:"/api/admin/update-password",
            type:"post",
            dataType:"json",
            data:{
                password:old,
                newPassword:new_pwd,
                newPassword_confirmation:con_pwd
            },
            success:function(data){
                if(data.status['errCode'] == 0){
                    hint1("修改密码成功!");  

                    window.location.href = "/admin/user/index";
                }else{
                    hint(data.status.message);
                }
            },
            error:function(jqXHR, textStatus, errorThrown){
                hint(jqXHR.responseText);
            }
        });
    }
</script>
@stop


